<template>
    <div class="app-container">
      <el-row :gutter="20">
        <el-col :span="6" :xs="24" style="width: 300px;">
          <el-card class="box-card">
            <div slot="header" class="clearfix">
              <span>业主信息</span>
            </div>
            <div>
              <div class="text-center">
                <userAvatar />
              </div>
              <ul class="list-group list-group-striped">
                <li class="list-group-item">
                  <svg-icon icon-class="user" />用户名称
                  <div class="pull-right">{{ user.name}}</div>
                </li>
                <li class="list-group-item">
                  <svg-icon icon-class="phone" />手机号码
                  <div class="pull-right">{{ user.phone }}</div>
                </li>
                <li class="list-group-item">
                  <svg-icon icon-class="email" />用户邮箱
                  <div class="pull-right">{{ user.email }}</div>
                </li>
                <li class="list-group-item">
                  <svg-icon icon-class="tree" />公司名称
                  <div class="pull-right">{{ user.company }}</div>
                </li>
               
               
              </ul>
            </div>
          </el-card>
        </el-col>
        <!-- <el-col :span="18" :xs="24">
          <el-card>
            <div slot="header" class="clearfix">
              <span>基本资料</span>
            </div>
            <el-tabs v-model="activeTab">
              <el-tab-pane label="基本资料" name="userinfo">
                <userInfo :user="user" />
              </el-tab-pane>
              <el-tab-pane label="修改密码" name="resetPwd">
                <resetPwd />
              </el-tab-pane>
            </el-tabs>
          </el-card>
        </el-col> -->


        <el-col :span="18" :xs="24">
                <el-card>
                    <div slot="header" class="clearfix">
                        <span>基本资料</span>
                    </div>
                    <el-tabs>
                        <el-tab-pane label="商铺信息">
                            <el-table :data="rentalcontractList" style="width: 100%">
                                <el-table-column prop="code" label="商铺编号" width="180">
                                   
                                </el-table-column>
                                <el-table-column prop="dName" label="商业区" width="180">
                                  
                                </el-table-column>
                                <el-table-column prop="bName" label="漏洞" width="180">
                                  
                                </el-table-column>
                                <el-table-column prop="hireInfo" label="商铺名" width="180">
                                  
                                </el-table-column>
                              
                            </el-table>
                        </el-tab-pane>
                        <el-tab-pane label="历史商铺信息">
                            <el-table :data="list" style="width: 100%">
                                <el-table-column prop="shopId" label="商铺编号" width="180">
                                    <template slot-scope="scope">
                                        {{ shops[scope.row.shopsId] }}
                                    </template>
                                </el-table-column>
                                <el-table-column prop="type" label="类型" width="180">
                                    <template slot-scope="scope">
                                        <el-tag size="small" v-if="scope.row.type==1">拥有</el-tag>
                                        <el-tag size="small" type="success" v-if="scope.row.type==0">租赁</el-tag>
                                    </template>
                                </el-table-column>
                                <el-table-column label="开始时间" align="center" prop="startTime" width="180">
                                    <template slot-scope="scope">
                                        <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column label="结束时间" align="center" prop="endTime" width="180">
                                    <template slot-scope="scope">
                                        <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
                                    </template>
                                </el-table-column>
                            </el-table>
                        </el-tab-pane>
                        <el-tab-pane label="待缴费信息">
                            <el-table :data="ChargedataList" style="width: 100%">
                                <el-table-column prop="trade" label="收费项名称" width="180">
                                    
                                </el-table-column>
                                <el-table-column prop="startTime" label="起收日期" width="180">
                                    <template slot-scope="scope">
                                        <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column label="到期日期" align="center" prop="endTime" width="180">
                                    <template slot-scope="scope">
                                        <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column label="缴费期限" align="center" prop="endTime" width="180">
                                    <template slot-scope="scope">
                                        <span>{{ parseTime(scope.row.deadlineTime, '{y}-{m}-{d}') }}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="shopsId" label="单价" width="180"></el-table-column>
                                <el-table-column prop="taxi" label="数量" width="180"></el-table-column>
                                <el-table-column prop="rent" label="金额" width="180"></el-table-column> 
                               </el-table>
                         </el-tab-pane>
                        <el-tab-pane label="历史缴费信息">
                            <el-table :data="list" style="width: 100%">
                                <el-table-column prop="chargeitemId" label="收费项名称" width="180">
                                    <template slot-scope="scope">
                                        {{ chargeitem[scope.row.chargeitemId] }}
                                    </template>
                                </el-table-column>
                                <el-table-column prop="startTime" label="起收日期" width="180">
                                    <template slot-scope="scope">
                                        <span>{{ parseTime(scope.row.startTime, '{y}-{m}-{d}') }}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column label="到期日期" align="center" prop="endTime" width="180">
                                    <template slot-scope="scope">
                                        <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column label="缴费期限" align="center" prop="deadlineTime" width="180">
                                    <template slot-scope="scope">
                                        <span>{{ parseTime(scope.row.deadlineTime, '{y}-{m}-{d}') }}</span>
                                    </template>
                                </el-table-column>
                                <el-table-column prop="univalence" label="单价" width="180"></el-table-column>
                                <el-table-column prop="number" label="数量" width="180"></el-table-column>
                                <el-table-column prop="money" label="金额" width="180"></el-table-column> 
                               </el-table>
                        </el-tab-pane>
                    </el-tabs>
                </el-card>
            </el-col>
      </el-row>
    </div>
  </template>
  
  <script>
//   import userAvatar from "./userAvatar";
//   import userInfo from "./userInfo";
//   import resetPwd from "./resetPwd";
import { listRentalcontract,listhireRentalcontract } from "../../../api/hyj/rentalcontract"
  import { getZyxx } from "@/api/hyj/zyxx";
  export default {
    
    data() {
      return {
        user: {},
        money:{
          hirerId:''
        },
           // 遮罩层
           loading: true,
            // 商铺信息查询参数
            queryRentalcontract: {
                pageNum: 1,
                pageSize: 9999,
                shopsId: null,
                hirerId: null,
                state: null
            },
            //商铺id-编号集合
            shopsList: null,
            shops: {},    //用户id与用户名的键值对
            //   商铺信息list
            rentalcontractList: [],
            ChargedataList:[],
            chargeitemList:[],
            chargeitem:{},
            list:[]
      };
    },
    created() {
      this.getUser();
      this.getMoney();
    },
    methods: {
        mounted() {
            this.getUser()
        },
        getMoney(){
          this.money.hirerId=this.$route.query.id;
          listRentalcontract(this.money).then((result) => {
            this.ChargedataList=result.rows
          }).catch((err) => {
            
          });
          listhireRentalcontract(this.money).then(resp=>{
            this.rentalcontractList=resp.rows
          })
          
        },
      getUser() {
       let id=this.$route.query.id;
    //    console.log(id);
    getZyxx(id).then((result) => {
        this.user=result.data;
        console.log(result);
    })
      }
    }
  };
  </script>
  